<template>
  <div class="xdh-form-tag">
    <el-tag :type="theme" @click.native="handleClick(fieldValue)" :disable-transitions="false" :effect="effect">{{fieldValue}}
    </el-tag>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: String,
      default() {
        return ""
      }
    },
    theme: {
      type: String,
      default: '',
      validator(val) {
        return ['success', 'info', 'warning', 'danger', ''].includes(val)
      }
    },
    effect:{
      type: String,
      default: 'light',
      validator(val) {
        return ['dark', 'light', 'plain'].includes(val)
      }
    }
  },
  data() {
    return {

    }
  },
  computed: {
    fieldValue: {
      get() {
        return this.value || ""
      },
      set(val) {
        this.$emit('input', val)
      }
    }
  },
  methods: {
    handleClick(tag) {
      this.$emit('click', tag)
    },
  }
}
</script>

